from typing import List


class Solution:
    def largestTriangleArea(self, points: List[List[int]]) -> float:
        ans = 0
        hull = self.convexHull(points)
        for i in range(len(hull)):
            for j in range(i + 1, len(hull)):
                for k in range(j + 1, len(hull)):
                    ans = max(ans, self.area(hull[i], hull[j], hull[k]))
        return ans
        
    def distance(self, p1, p2):
        return ((p1[0] - p2[0])**2 + (p1[1] - p2[1])**2)**0.5
    
    def area(self, p1, p2, p3):
        a, b, c = self.distance(p1, p2), self.distance(p2, p3), self.distance(p1, p3)
        p = (a + b + c) / 2
        return (p * (p - a) * (p - b) * (p - c))**0.5
    
    def cross(self, p1, p2, p3):
        '''叉乘
        '''
        return (p2[0] - p1[0]) * (p3[1] - p1[1]) - (p2[1] - p1[1]) * (p3[0] - p1[0])

    def convexHull(self, points):
        '''求凸包
        '''
        points.sort()
        l, r = [], []
        for p in points:
            while len(l) >= 2 and self.cross(l[-2], l[-1], p) < 0:
                l.pop()
            l.append(p)
        for p in reversed(points):
            while len(r) >= 2 and self.cross(r[-2], r[-1], p) < 0:
                r.pop()
            r.append(p)
        return l[:-1] + r[:-1]